print("напишите скобочную последовательность")
a = input()
c = ''
for char in a:
    if char == "(":
        c += char
    if char == ")":
        if len(c) > 0:
            if c[len(c) - 1] == "(":
                c = c[:-1]
    if char == "[":
        c += char
    if char == "]":
        if len(c) > 0:
            if c[len(c) - 1] == "[":
                c = c[:-1]
    if char == "{":
        c += char
    if char == "}":
        if len(c) > 0:
            if c[len(c) - 1] == "{":
                c = c[:-1]
    if char == "<":
        c += char
    if char == ">":
        if len(c) > 0:
            if c[len(c) - 1] == "<":
                c = c[:-1]

if len(c) == 0:
    print('True')
else:
    print('False')